|
|
|
|
|
|
|
would be CheckingAccount. For a defense contractor, Government would be a meaningful Visual Basic class. |
|
|
|
|
|
|
|
|
At design time, class definitions are static (as opposed to dynamic at runtime). During this time, you are defining and/or refining the uses of behavior between Visual Basic classes. Thus, the usage protocol between classes is your main concern. Included in this protocol is not only the precise invocation of methods but also the signature of the methods. This signature includes the ordering and types of arguments in a method's argument list. Considerable changes to class method signatures during construction (programming phase) can lead to extensive code rewrites and communication problems between classes and subsystems. |
|
|
|
|
|
|
|
|
Sometimes you will find it necessary to convert semantic relationships between classes. For instance, you could have originally designed a CheckingAccount class to have an inheritance relationship to the BankAccount interface class. However, during construction, you found this relationship too awkward or performance costly. In this case, you could convert the relationship to delegation. Then BankAccount would have the common behavior and identity of all bank account products, and CheckingAccount would be given the delegated responsibility of behavior and identity that is particular to checking account products. Such architectural changes might trigger the need for a minor domain analysis to justify the new relationship. |
|
|
|
|
|
|
|
|
Tip When elaborating a class at design time, remember that you can't expect to correctly design the class's public methods and attributes the first time or even the second time. A good class interface takes time to develop and nurture. Class design is an iterative (cyclical) process. |
|
|
|
|
|
|
|
|
|
When elaborating methods, you will fine-tune how each method operates. If a method contains too many lines of code (say, more than ten or twenty), you should definitely consider creating additional methods to offload some of the work. These additional methods are known as helper or collaborating methods. The idea is to keep class methods simple. |
|
|
|
|
|
|
|
|
Preparing Visual Basic Objects for Runtime Behavior |
|
|
|
|
|
|
|
|
At runtime, your classes come alive in the form of objects. One object collaborates with another to carry out some responsibility on behalf of a client. All this sounds wonderful, |
|
|
|
|
|